package org.me.rmi.Server;

import org.me.rmi.Interface.IPerson;
import org.me.rmi.Interface.PersonImpl;
import org.me.rmi.Skeleton.PersonSkeleton;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Created by wangyg on 2016/11/1.
 */
public class PersonServer {
	public static void main(String[] args) throws IOException {
		ServerSocket serverSocket = new ServerSocket(9000);
		// new object server
		IPerson person = new PersonImpl("Richard", 34);
		int count=0;

		while (true) {
			Socket socket = serverSocket.accept();
			count++;
			PersonSkeleton skel = new PersonSkeleton(person,socket);
			skel.start();
			System.out.println("这是第"+count+"个连接，线程名为"+skel.getName());
		}
	}


}
